package com.jl.jlapp.adapter;

import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jl.jlapp.R;
import com.jl.jlapp.eneity.GoodsDetailModel;
import com.jl.jlapp.utils.CustomGridLayoutManager;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

public class EvaluateListAdapter
  extends BaseQuickAdapter<GoodsDetailModel.ResultDataBean.GoodsEvaluationsBean, BaseViewHolder>
{
  GoodsEvaluationImageAdapter goodsEvaluationImageAdapter;
  OnClickGoodsPicItemListener onClickGoodsPicItemListener;
  List<ImageView> starts;
  
  public EvaluateListAdapter(int paramInt, @Nullable List<GoodsDetailModel.ResultDataBean.GoodsEvaluationsBean> paramList)
  {
    super(paramInt, paramList);
  }
  
  protected void convert(BaseViewHolder paramBaseViewHolder, final GoodsDetailModel.ResultDataBean.GoodsEvaluationsBean paramGoodsEvaluationsBean)
  {
    ImageView localImageView1 = (ImageView)paramBaseViewHolder.getView(R.id.iv_vip);
    RecyclerView localRecyclerView = (RecyclerView)paramBaseViewHolder.getView(R.id.evaluation_img);
    paramBaseViewHolder.setText(R.id.tv_date, new SimpleDateFormat("yyyy-MM-dd").format(Long.valueOf(paramGoodsEvaluationsBean.getEvaluationTime())));
    paramBaseViewHolder.setText(R.id.tv_evaluate_detail, paramGoodsEvaluationsBean.getEvaluationContent());
    paramBaseViewHolder.setText(R.id.tv_user_num, replacePhoneNum(paramGoodsEvaluationsBean.getUser().getPhone()));
    localImageView1.setVisibility(View.GONE);
    localRecyclerView.setVisibility(View.GONE);
    ImageView localImageView2 = (ImageView)paramBaseViewHolder.getView(R.id.evaluation_star1);
    ImageView localImageView3 = (ImageView)paramBaseViewHolder.getView(R.id.evaluation_star2);
    ImageView localImageView4 = (ImageView)paramBaseViewHolder.getView(R.id.evaluation_star3);
    ImageView localImageView5 = (ImageView)paramBaseViewHolder.getView(R.id.evaluation_star4);
    ImageView localImageView6 = (ImageView)paramBaseViewHolder.getView(R.id.evaluation_star5);
    this.starts = new ArrayList();
    this.starts.add(localImageView2);
    this.starts.add(localImageView3);
    this.starts.add(localImageView4);
    this.starts.add(localImageView5);
    this.starts.add(localImageView6);
    int i = 0;
    while (i < 5)
    {
      ((ImageView)this.starts.get(i)).setImageDrawable(paramBaseViewHolder.itemView.getResources().getDrawable(R.drawable.icon_star_gray_s));
      i += 1;
    }
    if (paramGoodsEvaluationsBean.getUser().getIsVip() == 1)
    {
      localImageView1.setVisibility(View.VISIBLE);
      localImageView1.setImageDrawable(paramBaseViewHolder.itemView.getResources().getDrawable(R.drawable.btn_vip));
    }
    int j = (int)Math.floor(paramGoodsEvaluationsBean.getScore());
    i = 0;
    while (i < j)
    {
      ((ImageView)this.starts.get(i)).setImageDrawable(paramBaseViewHolder.itemView.getResources().getDrawable(R.drawable.icon_star_yellow_s));
      i += 1;
    }
    if (paramGoodsEvaluationsBean.getEvaluationPics().size() > 0)
    {
      localRecyclerView.setVisibility(View.VISIBLE);
      localRecyclerView.setLayoutManager(new CustomGridLayoutManager(paramBaseViewHolder.itemView.getContext(), 5, false));
      this.goodsEvaluationImageAdapter = new GoodsEvaluationImageAdapter(2131361927, paramGoodsEvaluationsBean.getEvaluationPics());
      localRecyclerView.setAdapter(this.goodsEvaluationImageAdapter);
      this.goodsEvaluationImageAdapter.setOnItemChildClickListener(new OnItemChildClickListener()
      {
        public void onItemChildClick(BaseQuickAdapter paramAnonymousBaseQuickAdapter, View paramAnonymousView, int paramAnonymousInt)
        {
          String picUrl = ((GoodsDetailModel.ResultDataBean.GoodsEvaluationsBean.EvaluationPicsBean)paramGoodsEvaluationsBean.getEvaluationPics().get(paramAnonymousInt)).getPicUrl();
          if (EvaluateListAdapter.this.onClickGoodsPicItemListener != null) {
            EvaluateListAdapter.this.onClickGoodsPicItemListener.OnClickGoodsPicItem(picUrl);
          }
        }
      });
    }
  }
  
  public String replacePhoneNum(String paramString)
  {
    return paramString.substring(0, 3) + "****" + paramString.substring(7, 11);
  }
  
  public void setOnClickGoodsPicItemListener(OnClickGoodsPicItemListener paramOnClickGoodsPicItemListener)
  {
    this.onClickGoodsPicItemListener = paramOnClickGoodsPicItemListener;
  }
  
  public static abstract interface OnClickGoodsPicItemListener
  {
    public abstract void OnClickGoodsPicItem(String paramString);
  }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/adapter/EvaluateListAdapter.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */